<?php

namespace App\Providers;

use App\EloquentORM\Article;
use App\EloquentORM\ArticleLabel;
use App\EloquentORM\Category;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
	    Paginator::defaultView('layouts.pagination.default');
	
	    
	    view()->composer('layouts/app', function ($view) {
		    $siteInfo=Category::getAll ();
		
		    $top = Article::query()
			    ->orderBy('top','DESC')
			    ->orderBy('order','DESC')
			    ->get(['id','title']);
		
		    $label = ArticleLabel::query()->get();
		    
		    
		    $view->with(['NavMenuList'=>$siteInfo,'label'=>$label,'top'=>$top]);
	    });
    }
	
    
}
